package Reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class ReflectDemo6 {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException {
        Class cls = Class.forName("Reflect.Person");
        Method method = cls.getMethod("say",String.class,int.class);

        String name = method.getName();
        System.out.println("方法名:"+name);
        int modifiers = method.getModifiers();
        switch (modifiers){
            case Modifier.PUBLIC:
                System.out.println("公开方法");
                break;
            case Modifier.PRIVATE:
                System.out.println("私有方法");
                break;
            case Modifier.PROTECTED:
                System.out.println("受保护方法");
                break;
            case Modifier.STATIC:
                System.out.println("静态方法");
                break;
            default:
                System.out.println("默认方法");
        }
        int count = method.getParameterCount();
        System.out.println();
        Class[]type = method.getParameterTypes();
        for(int i = 0;i<0;i++) {
            System.out.println(type);
        }
    }
}
